<?php

class Wlib_Test_Db
{
    static public function execSqlFromFile($filePath, $dbAdapter)
    {
        $config = $dbAdapter->getConfig();
        $cmd = "mysql -h{$config["host"]} -u{$config["username"]} -p{$config["password"]} {$config["dbname"]} < $filePath 2>&1 1> /dev/null";

        $res = shell_exec($cmd);

        if(is_string($res) && strlen($res)) {
            throw new Zend_Db_Exception('Error message "' . $res . '" in file "' . $filePath . '"');
        }
    }
}